<html><head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>SwapElements</title></head>
<body bgcolor="#EFF1F0" link="#3A3966" vlink="#000000" alink="#000000">
<font face="Verdana, sans-serif" size="2"><p align="center"><b><font size="4">SwapElements()</font></b></p>
<p><b>语法</b></p><blockquote>
<font color="#3A3966"><b>SwapElements</b></font>(List(), *FirstElement, *SecondElement)</blockquote>

</blockquote>
<b>概要</b><br><blockquote>



Swaps the position of two elements in the specified list. This command is a fast 
way to reorganize a list, because it does not actually move the element data itself. 

 

</blockquote><p><b>参数</b></p><blockquote>
<style type="text/css">
table.parameters { border-spacing: 0px; border-style: none; border-collapse: collapse; }
table.parameters td { border-width: 1px; padding: 6px; border-style: solid; border-color: gray; vertical-align: top; font-family:Arial; font-size:10pt; }
</style>
<table width="90%" class="parameters">
<tr><td width="10%"><i>List()</i></td>
<td width="90%"> 
 
The name of your list variable, created with the <a href="../reference/newlist.html">NewList</a> function. 
You must include the brackets after the list name. 

 

</td></tr>
<tr><td><i>*FirstElement</i></td>
<td> 
 
Address of the first element to swap. You can get this address by using the @ operator on the list name. 

 

</td></tr>
<tr><td><i>*SecondElement</i></td>
<td> 
 
Address of the second element to swap. You can get this address by using the @ operator on the list name. 

 

</td></tr>
</table>
</blockquote><p><b>返回值</b></p><blockquote>
无.


</blockquote><p><b>示例</b></p><blockquote>

<pre><font face="Courier New, Courier, mono"size="2">  <b><font color="#3A3966">NewList</font></b> <font color="#3A3966">Numbers</font>()
  
  <b><font color="#3A3966">For</font></b> k=0 <b><font color="#3A3966">To</font></b> 10
<font color="#3A3966">    AddElement</font>(<font color="#3A3966">Numbers</font>())
<font color="#3A3966">    Numbers</font>() = k
  <b><font color="#3A3966">Next</font></b>
    
<font color="#3A3966">  SelectElement</font>(<font color="#3A3966">Numbers</font>(), 3) <font color="#3A3966">; Get the 4th element (first element is 0)</font>
  *FirstElement = @Numbers()
  
<font color="#3A3966">  SelectElement</font>(<font color="#3A3966">Numbers</font>(), 9) <font color="#3A3966">; Get the 10th element</font>
  *SecondElement = @Numbers()
  
  <font color="#3A3966">; Swap the 3 with the 9</font>
  <font color="#3A3966">;</font>
<font color="#3A3966">  SwapElements</font>(<font color="#3A3966">Numbers</font>(), *FirstElement, *SecondElement)
    
  <font color="#3A3966">; Prove it</font>
  <font color="#3A3966">;</font>
  <b><font color="#3A3966">ForEach</font></b> <font color="#3A3966">Numbers</font>()
    <b><font color="#3A3966">Debug</font></b> <font color="#3A3966">Numbers</font>()
  <b><font color="#3A3966">Next</font></b>
</font></pre>

</blockquote><p><b>参阅</b></p><blockquote>

<a href="moveelement.html">MoveElement()</a> 

</Blockquote><p><b>已支持操作系统 </b><Blockquote>所有</Blockquote></p><center>&lt;- <a href=splitlist.html>SplitList()</a> - <a href="index.html">List Index</a><br><br>

</body></html>